<?php

ini_set('display_errors','on');

/**
 * Configuration / Startup Script
 *
 * @author Sean_T23
 * @package Plex
 */

require_once('lib/Plex.php');

// ====================
// = Plexs Base Paths =
// ====================
Plex::$BASE_DIR = dirname(__FILE__).'/';
Plex::$BASE_URL = substr($_SERVER['SCRIPT_NAME'],0,strrpos($_SERVER['SCRIPT_NAME'],'/')+1);
Plex::$BASE_URL = Plex::$BASE_URL == '/' ? '' : Plex::$BASE_URL;

// =================
// = Include Paths =
// =================
Plex::add_include_dir(Plex::$BASE_DIR."lib");
Plex::add_include_dir(Plex::$BASE_DIR."model");
Plex::add_include_dir(Plex::$BASE_DIR."plugins");

function __autoload($className) {
	if(substr($className,0,2)=='in') {
		$interface = substr($className,2);
		require_once("interface/$interface.php");
	}
	else
	require_once("$className.php");
	
}

function errorHandler($a,$b,$c,$d) {
	Error::handler($a,$b,$c,$d);
}

set_error_handler("errorHandler");
date_default_timezone_set("UTC");
session_start();